#ifndef LC_PROC6SYS_H_
#define LC_PROC6SYS_H_

#include <map>
#include <utility>
#include <lagniappe/System.h>
#include "lc_Proc0_ProcElement.h"
#include "lc_Proc1_ProcElement.h"
#include "lc_Proc2_ProcElement.h"
#include "lc_Proc3_ProcElement.h"
#include "lc_Proc4_ProcElement.h"
#include "lc_Proc5_ProcElement.h"
#include "lc_Mem0_Memory.h"
#include "lc_CC0_CommChannel.h"
#include "lc_CC1_CommChannel.h"
#include "lc_CC2_CommChannel.h"
#include "lc_CC3_CommChannel.h"
#include "lc_CC4_CommChannel.h"
#include "lc_CC5_CommChannel.h"
#include "lc_Mutex0_Mutex.h"

class proc6sys : public lagniappe::System {

public:
	virtual lagniappe::ProcElement * createProfilerResources() {
		procMap["Proc0"] = new Proc0(true);
		return procMap["Proc0"];
	}
	virtual void destroyProfilerResources() {
		delete procMap["Proc0"];
	}
	virtual void createResources() {
		lagniappe::ProcElement * tempProc;
		lagniappe::CommChannel * tempChan;
		chanMap["CC0"] = new CC0;
		chanMap["CC1"] = new CC1;
		chanMap["CC2"] = new CC2;
		chanMap["CC3"] = new CC3;
		chanMap["CC4"] = new CC4;
		chanMap["CC5"] = new CC5;
		tempProc = new Proc0;
		procMap["Proc0"] = tempProc;
		addFreeProc(tempProc);
		tempProc->setSrcChan(chanMap["CC0"]);
		tempProc = new Proc1;
		procMap["Proc1"] = tempProc;
		addFreeProc(tempProc);
		tempProc->setSrcChan(chanMap["CC1"]);
		tempProc = new Proc2;
		procMap["Proc2"] = tempProc;
		addFreeProc(tempProc);
		tempProc->setSrcChan(chanMap["CC2"]);
		tempProc = new Proc3;
		procMap["Proc3"] = tempProc;
		addFreeProc(tempProc);
		tempProc->setSrcChan(chanMap["CC3"]);
		tempProc = new Proc4;
		procMap["Proc4"] = tempProc;
		addFreeProc(tempProc);
		tempProc->setSrcChan(chanMap["CC4"]);
		tempProc = new Proc5;
		procMap["Proc5"] = tempProc;
		addFreeProc(tempProc);
		tempProc->setSrcChan(chanMap["CC5"]);
		tempProc = procMap["Proc0"];
		tempChan = chanMap["CC1"];
		tempProc->addDestChan(procMap["Proc1"], tempChan);
		tempChan = chanMap["CC2"];
		tempProc->addDestChan(procMap["Proc2"], tempChan);
		tempChan = chanMap["CC3"];
		tempProc->addDestChan(procMap["Proc3"], tempChan);
		tempChan = chanMap["CC4"];
		tempProc->addDestChan(procMap["Proc4"], tempChan);
		tempChan = chanMap["CC5"];
		tempProc->addDestChan(procMap["Proc5"], tempChan);
		tempProc = procMap["Proc1"];
		tempChan = chanMap["CC0"];
		tempProc->addDestChan(procMap["Proc0"], tempChan);
		tempChan = chanMap["CC2"];
		tempProc->addDestChan(procMap["Proc2"], tempChan);
		tempChan = chanMap["CC3"];
		tempProc->addDestChan(procMap["Proc3"], tempChan);
		tempChan = chanMap["CC4"];
		tempProc->addDestChan(procMap["Proc4"], tempChan);
		tempChan = chanMap["CC5"];
		tempProc->addDestChan(procMap["Proc5"], tempChan);
		tempProc = procMap["Proc2"];
		tempChan = chanMap["CC0"];
		tempProc->addDestChan(procMap["Proc0"], tempChan);
		tempChan = chanMap["CC1"];
		tempProc->addDestChan(procMap["Proc1"], tempChan);
		tempChan = chanMap["CC3"];
		tempProc->addDestChan(procMap["Proc3"], tempChan);
		tempChan = chanMap["CC4"];
		tempProc->addDestChan(procMap["Proc4"], tempChan);
		tempChan = chanMap["CC5"];
		tempProc->addDestChan(procMap["Proc5"], tempChan);
		tempProc = procMap["Proc3"];
		tempChan = chanMap["CC0"];
		tempProc->addDestChan(procMap["Proc0"], tempChan);
		tempChan = chanMap["CC1"];
		tempProc->addDestChan(procMap["Proc1"], tempChan);
		tempChan = chanMap["CC2"];
		tempProc->addDestChan(procMap["Proc2"], tempChan);
		tempChan = chanMap["CC4"];
		tempProc->addDestChan(procMap["Proc4"], tempChan);
		tempChan = chanMap["CC5"];
		tempProc->addDestChan(procMap["Proc5"], tempChan);
		tempProc = procMap["Proc4"];
		tempChan = chanMap["CC0"];
		tempProc->addDestChan(procMap["Proc0"], tempChan);
		tempChan = chanMap["CC1"];
		tempProc->addDestChan(procMap["Proc1"], tempChan);
		tempChan = chanMap["CC2"];
		tempProc->addDestChan(procMap["Proc2"], tempChan);
		tempChan = chanMap["CC3"];
		tempProc->addDestChan(procMap["Proc3"], tempChan);
		tempChan = chanMap["CC5"];
		tempProc->addDestChan(procMap["Proc5"], tempChan);
		tempProc = procMap["Proc5"];
		tempChan = chanMap["CC0"];
		tempProc->addDestChan(procMap["Proc0"], tempChan);
		tempChan = chanMap["CC1"];
		tempProc->addDestChan(procMap["Proc1"], tempChan);
		tempChan = chanMap["CC2"];
		tempProc->addDestChan(procMap["Proc2"], tempChan);
		tempChan = chanMap["CC3"];
		tempProc->addDestChan(procMap["Proc3"], tempChan);
		tempChan = chanMap["CC4"];
		tempProc->addDestChan(procMap["Proc4"], tempChan);
		lagniappe::MemGroup * tempMG = NULL;
		memGroupList.push_back(tempMG = new lagniappe::MemGroup());
		tempMG->insertProcessor(procMap["Proc4"]);
		tempMG->insertProcessor(procMap["Proc5"]);
		tempMG->insertProcessor(procMap["Proc2"]);
		tempMG->insertProcessor(procMap["Proc3"]);
		tempMG->insertProcessor(procMap["Proc0"]);
		tempMG->insertProcessor(procMap["Proc1"]);
		for(std::map<std::string, lagniappe::ProcElement *>::iterator iter = procMap.begin();
			iter != procMap.end(); iter++) {
			iter->second->init();
		}
	procIter = procMap.begin();
	}
	virtual lagniappe::Mutex * getNewMutex() {
		return new Mutex0();
	}
};
#endif
